<template>
   <div class="slideMenu">
        <headers :username="username"></headers>
        <template v-if=" username == ga_account ">
            <el-menu default-active="1" theme="dark" class="el-menu-vertical-demo">
                <el-menu-item index="1">
                    <router-link to="/">
                        <div class="item"><i class="material-icons">donut_small</i></div>
                        <div class="item">首页</div>
                    </router-link>
                </el-menu-item>
                <el-menu-item index="3">
                    <router-link to="/products">
                        <div class="item"><i class="material-icons">extension</i></div>
                        <div class="item">所有产品</div>
                    </router-link>
                </el-menu-item>
            </el-menu>
        </template>
        <template v-else>
            <el-menu default-active="1" theme="dark" class="el-menu-vertical-demo">
                <el-menu-item index="1">
                    <router-link to="/">
                        <div class="item"><i class="material-icons">donut_small</i></div>
                        <div class="item">首页</div>
                    </router-link>
                </el-menu-item>
                <el-menu-item index="2">
                    <router-link to="/sites">
                        <div class="item"><i class="material-icons">receipt</i></div>
                        <div class="item">主页管理</div>
                    </router-link>
                </el-menu-item>
                <el-menu-item index="3">
                    <router-link to="/products">
                        <div class="item"><i class="material-icons">extension</i></div>
                        <div class="item">所有产品</div>
                    </router-link>
                </el-menu-item>
                <template v-if="administrator">
                <el-menu-item index="4">
                    <router-link to="/orders">
                        <div class="item"><i class="material-icons">receipt</i></div>
                        <div class="item">订单管理</div>
                    </router-link>
                </el-menu-item>
                </template>
                <el-menu-item index="5">
                    <router-link to="/comments">
                        <div class="item"><i class="material-icons">speaker_notes</i></div>
                        <div class="item">评论管理</div>
                    </router-link>
                </el-menu-item>
                <el-menu-item index="6">
                    <router-link to="currency">
                        <div class="item"><i class="material-icons">monetization_on</i></div>
                        <div class="item">货币管理</div>
                    </router-link>
                </el-menu-item>
                <el-menu-item index="7" v-if="administrator">
                        <!--<a href="/user.php">-->
                          <router-link to="/pay">
                            <div class="item"><i class="material-icons">settings_applications</i></div>
                            <div class="item">PAY</div>
                         </router-link>
                        <!--</a>-->
                    </el-menu-item>
                <template v-if="administrator">
                    <el-menu-item index="8">
                        <router-link to="/user">
                            <div class="item"><i class="material-icons">settings_applications</i></div>
                            <div class="item">管理员</div>
                        </router-link>
                    </el-menu-item>
                    <el-menu-item index="9">
                        <router-link to="/usergroup">
                            <div class="item"><i class="material-icons">settings_applications</i></div>
                            <div class="item">用户组</div>
                        </router-link>
                    </el-menu-item>
                     <el-menu-item index="10">
                        <router-link to="/stat" v-if='administrator'>
                            <div class="item"><i class="material-icons">receipt</i></div>
                            <div class="item">统计数据</div>
                        </router-link>
                    </el-menu-item>
                </template>
            </el-menu>
        </template>
    </div>
</template>

<script>

import headers from './headers.vue'



export default {
    data() {
        return {
            ga_account: 'googleID'
        }
    }
    , computed: {
        username(){
            return this.$store.state.username
        }
        , administrator(){
            return this.$store.state.administrator
        }
    }
    , components: { headers }
    , mounted(){
        this.$http.get("/logInfo.php").then(res => {
            this.$store.commit('login', res.body.admin);
        });
    }

}
</script>


